//
//  ViewController.m
//  Font
//
//  Created by Justsoso on 16/3/3.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) NSArray *fontList;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    //得到字体数组
    self.fontList=[UIFont familyNames];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
//

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.fontList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    //设置字体
    UIFont *font=[UIFont fontWithName:self.fontList[indexPath.row] size:20];
    cell.textLabel.font=font;
    cell.textLabel.text = self.fontList[indexPath.row];
    return cell;
    
}


@end
